<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center listDetail_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub listDetail_fd0_0'>
          <view class='flex flex-wrap align-center listDetail_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  listDetail_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='listDetail_fd0_0_c1_c0'>任务详情</text>
          </view>
          <view class='flex flex-wrap align-center justify-end listDetail_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center">
        <view class='flex flex-direction align-stretch listDetail_fd1_0'>
          <view class='flex  align-center justify-between flex-sub'>
            <text class='listDetail_fd1_0_c0_c0'>任务标题：</text>
            <text class='listDetail_fd1_0_c0_c1'>{{dataMessage.renwubiaoti}}</text>
          </view>
          <view class='flex  align-center justify-between flex-sub listDetail_fd1_0_c1'>
            <text class='listDetail_fd1_0_c0_c0'>任务描述：</text>
            <view class='listDetail_fd1_0_c0_c1'>{{dataMessage.renwumiaoshu}}</view>
          </view>
          <view class='flex  align-center justify-between flex-sub'>
            <text class='listDetail_fd1_0_c0_c0'>任务下发时间：</text>
            <text class='listDetail_fd1_0_c0_c1'>{{dataMessage.tijiaoshijian}}</text>
          </view>
          <view class='flex  align-center justify-between flex-sub listDetail_fd1_0_c3'>
            <text class='listDetail_fd1_0_c0_c0'>任务截至时间：</text>
            <text class='listDetail_fd1_0_c0_c1'>{{dataMessage.jiezhishijian}}</text>
          </view>
        </view>
        <view class='flex flex-wrap align-center listDetail_fd1_1'>
          <text class='listDetail_fd1_1_c0'>任务图片</text>
        </view>
        <view class="listDetail_fd1_2" v-if="dataMessage.zhuangtai==1">
          <benben-images-upload ref="benbenImagesUploadfd1_2" :maxlength="9" :img-list.sync="img"
            :img-ids.sync="img_id">
            <template #content="{ num, maxlength, isShow, imgList }">
              <view class="flex flex-wrap align-start flex">

                <view v-for="(image, index) in imgList" :key="index" class='flex position-relative listDetail_fd1_20'>
                  <text class='fu-iconfont2 position-absolute listDetail_fd1_200'
                    @tap.stop="$refs.benbenImagesUploadfd1_2.delImage(index)">&#xE8E7;</text>
                  <image class='listDetail_fd1_201' @tap.stop="$refs.benbenImagesUploadfd1_2.previewImage(index)"
                    mode="aspectFill" :src='image'></image>
                </view>

                <image class='listDetail_fd1_21' @tap.stop="$refs.benbenImagesUploadfd1_2.manyChooseImage()"
                  v-if="isShow" mode="aspectFit" :src='STATIC_URL+"158.jpg"'></image>

              </view>
            </template>
          </benben-images-upload>
        </view>
        <view class='flex align-center flex-wrap listDetail_fd1_2' v-if="dataMessage.zhuangtai==2">
          <image v-for="(item, index) in dataMessage.renwutupian" @click.stop="prevImage(dataMessage.renwutupian,index)"
            :key="index" class='listDetail_fd1_201' mode="aspectFill" :src='item'></image>
        </view>
        <view class='flex flex-direction align-stretch listDetail_fd1_0' @click.stop="chooseMap">
          <view class='flex flex-wrap align-center justify-between flex-sub'>
            <text class='listDetail_fd1_3_c0_c0'>所在位置</text>
            <view class='flex flex-wrap align-center'>
              <text class='margin-right-sm listDetail_fd1_0_c0_c1'>{{dataMessage.suozaiweizhi}}</text>
              <image class='listDetail_fd1_3_c0_c1_c1' mode="aspectFit" :src='STATIC_URL+"153.png"'></image>
            </view>
          </view>
        </view>
        <button v-if="dataMessage.zhuangtai==1" class='listDetail_fd1_4' @click.stop="openpop">完成任务</button>
      </view>

      <!---flex布局flex布局结束-->
      <benben-popup v-model="popupShow1713839866323" :mask="true" :mask-close-able="false" mode='center'>
        <!---删除弹窗flex布局开始-->
        <view class="flex flex-direction flex-wrap align-center listDetail_flex_2">
          <text class='listDetail_fd2_0'>完成任务</text>
          <text class='listDetail_fd2_1'>确认任务已完成吗？提交后
            不可修改</text>
          <view class='flex flex-wrap align-center listDetail_fd2_2'>
            <button class='listDetail_fd2_2_c0' @click.stop="popupShow1713839866323=false">取消</button>
            <button class='listDetail_fd2_2_c1' @click.stop="submit">确认</button>
          </view>
        </view>

        <!---删除弹窗flex布局结束-->

      </benben-popup>


    </view>
  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        "popupShow1713839866323": false,
        "id": "1",
        dataMessage: '',
        "img": [],
        "img_id": "",
        suozaiweizhi: '',
        shengfen: '',
        chengshi: '',
        diqu: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        id
      } = options
      if (id !== undefined) this.id = id
      this.getDetailFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      prevImage(list, key0) {
        console.log('list', list, key0)
        uni.previewImage({
          urls: list,
          current: key0
        })
      },
      chooseMap() {
        if (this.dataMessage.zhuangtai == 2) {
          return;
        }
        // lat 34.339721  lng 108.949538
        let _this = this
        uni.getLocation({
          type: 'wgs84',
          success: function(res) {
            console.log('当前位置的经度：' + res.longitude);
            console.log('当前位置的纬度：' + res.latitude);
            _this.$api.post(global.apiUrls.post6629e9db2f87d, {
              location: res.longitude + ',' + res.latitude,
            }).then(res => {
              if (res.data.code == 1) {
                _this.dataMessage.shengfen = res.data.data.all.province
                _this.dataMessage.chengshi = res.data.data.all.city
                _this.dataMessage.diqu = res.data.data.all.district
                _this.dataMessage.suozaiweizhi = _this.dataMessage.shengfen + _this.dataMessage.chengshi +
                  _this
                  .dataMessage.diqu + res.data.data.all.township
              }
            })
          },
          complete(complete) {
            console.log('complete', complete)
          }
        });
      },
      openpop() {
        if (this.img.length == 0) {
          this.$message.info('请上传任务图片')
          return
        }
        this.popupShow1713839866323 = true
      },
      submit() {
        let renwutupian = this.img.join(',')
        this.$api.post(global.apiUrls.post6627871fcd304, {
          aid: this.id,
          renwutupian: renwutupian,
          suozaiweizhi: this.dataMessage.suozaiweizhi,
          shengfen: this.dataMessage.shengfen,
          chengshi: this.dataMessage.chengshi,
          diqu: this.dataMessage.diqu
        }).then(res => {
          this.popupShow1713839866323 = false
          if (res.data.code == 1) {
            this.getDetailFunc()
          } else {
            this.$message.info(res.data.msg)
          }
        })
      },
      async getDetailFunc() {
        //请求方法
        //数据验证

        let datadataMessage = await this.$api.get(global.apiUrls.post662787dae70ed, {
          aid: this.id
        });

        if (datadataMessage.data.code != 1) {
          this.$message.info(datadataMessage.data.msg);
          return
        }
        let infodataMessage = datadataMessage.data;
        this.dataMessage = infodataMessage.data

      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .listDetail_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .listDetail_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .listDetail_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .listDetail_fd0_0_c0 {
    width: 120rpx;
  }

  .listDetail_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .listDetail_fd1_4 {
    background: #0077FF;
    border-radius: 44rpx;
    width: 686rpx;
    line-height: 88rpx;
    font-size: 32rpx;
    color: #fff;
    height: 88rpx;
    margin: 50rpx auto 0rpx auto;
  }

  .listDetail_fd1_3_c0_c1_c1 {
    width: 12rpx;
    height: 22rpx;
    margin-top: 6rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .listDetail_fd1_3_c0_c0 {
    color: var(--benbenFontColor0);
    font-size: 32rpx;
  }

  .listDetail_fd1_21 {
    width: 200rpx;
    height: 200rpx;
    margin: 0rpx 16rpx 24rpx 0rpx;
  }

  .listDetail_fd1_201 {
    width: 200rpx;
    height: 200rpx;
    margin: 0rpx 10rpx 24rpx 10rpx;
    border-radius: 16rpx;
  }

  .listDetail_fd1_200 {
    top: 0rpx;
    right: 0rpx;
    z-index: 10;
    color: #ff5536;
  }

  .listDetail_fd1_20 {
    margin: 0rpx 24rpx 24rpx 0rpx;
  }

  .listDetail_fd1_2 {
    background: var(--benbenbgColor1);
    width: 710rpx;
    background-size: 100% auto;
    padding: 24rpx;
    margin: 0rpx auto 0rpx auto;
  }

  .listDetail_fd1_1_c0 {
    font-size: 32rpx;
    font-weight: 600;
  }

  .listDetail_fd1_1 {
    margin: 0rpx 0rpx 24rpx 24rpx;
  }

  .listDetail_fd1_0_c4_c1 {
    background: rgba(0, 119, 255, 1);
    border-radius: 33rpx 33rpx 33rpx 33rpx;
    width: 160rpx;
    line-height: 64rpx;
    font-size: 28rpx;
    color: #fff;
    height: 64rpx;
  }

  .listDetail_fd1_0_c4_c0 {
    background: rgba(255, 128, 0, 0.1);
    color: rgba(255, 128, 0, 1);
    font-size: 22rpx;
    width: 98rpx;
    line-height: 40rpx;
    border-radius: 4rpx 4rpx 4rpx 4rpx;
    text-align: center;
  }

  .listDetail_fd1_0_c4 {
    margin: 24rpx 0rpx 0rpx 0rpx;
  }

  .listDetail_fd1_0_c3 {
    border-bottom: 1px solid #eee;
    margin: 24rpx 0rpx 0rpx 0rpx;
    padding: 0rpx 0rpx 24rpx 0rpx;
  }

  .listDetail_fd1_0_c1 {
    margin: 24rpx 0rpx 24rpx 0rpx;
  }

  .listDetail_fd1_0_c0_c1 {
    color: var(--benbenFontColor0);
    font-weight: 600;
    width: 450rpx;
    text-align: right;
  }

  .listDetail_fd1_0_c0_c0 {
    color: rgba(102, 102, 102, 1);
  }

  .listDetail_fd1_0 {
    background: var(--benbenbgColor1);
    width: 710rpx;
    background-size: 100% auto;
    border-radius: 16rpx;
    margin: 24rpx auto 24rpx auto;
    padding: 24rpx;
  }

  .listDetail_flex_2 {
    background: #fff;
    width: 540rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }

  .listDetail_fd2_2_c1 {
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
    background: #fff;
    line-height: 110rpx;
    border-radius: 0rpx 0rpx 16rpx 0rpx;
    font-size: 32rpx;
    color: rgba(0, 137, 255, 1);
    font-weight: 500;
    width: 270rpx;
  }

  .listDetail_fd2_2_c0 {
    border-top: 1px solid #eee;
    background: #fff;
    line-height: 110rpx;
    border-radius: 0rpx 0rpx 0rpx 16rpx;
    font-size: 32rpx;
    color: rgba(153, 153, 153, 1);
    font-weight: 500;
    width: 270rpx;
  }

  .listDetail_fd2_2 {
    margin: 37rpx 0rpx 0rpx 0rpx;
  }

  .listDetail_fd2_1 {
    line-height: 52rpx;
    font-size: 32rpx;
    font-weight: 400;
    color: #333333;
    margin: 0rpx 32rpx 0rpx 32rpx;
    text-align: center;
  }

  .listDetail_fd2_0 {
    font-size: 36rpx;
    font-weight: 700;
    line-height: 32rpx;
    color: #333333;
    margin: 40rpx 0rpx 40rpx 0rpx;
  }
</style>
